// @ts-nocheck
/**
 * @Date: 2022-03-10 20:01:52
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-03-14 11:20:07
 * @FilePath: \zhihuReal\model\commentsMdl.js
 * @Description: 评论Schema
 */
const {
    Schema
} = require('../db/db')
const mongoose = require('../db/db')
const commentSchema = mongoose.Schema({
    __v: {
        type: Number,
        select: false
    },
    content: {
        type: String,
        required: true
    },
    commentator: {
        type: Schema.Types.ObjectId,
        ref: 'User',
        required: true,
        select: false
    },
    questionId: {
        type: String,
        required: true
    },
    answerId: {
        type: String,
        required: true
    },
    //点赞数
    likeCount: {
        type: Number,
        required: true,
        default: 0
    },
    //踩数
    unlikeCount: {
        type: Number,
        required: true,
        default: 0
    },
    //收藏数
    collectionCount: {
        type: Number,
        required: true,
        default: 0
    },
    //根评论
    rootCommentId: {
        type: String
    },
    //回复对象
    replyTo: {
        type: Schema.Types.ObjectId,
        ref: 'User',
    }
}, {
    timestamps: true
})
const Comment = mongoose.model('Comment', commentSchema)
module.exports = Comment